using System;
using System.Collections.Generic;
using System.Text;
using System.Configuration;
using Entities;
using System.Data.SqlClient;
using System.Data;
using DAL;

namespace BUS
{
    public class tbLoaiSPBUS
    {
        public static void Insert_LoaiSP(tbLoaiSP loaisp)
        {
            tbLoaiSPDAL loaispDAL = new tbLoaiSPDAL();
            loaispDAL.Insert(loaisp);
        }
        public static void Update_LoaiSP(tbLoaiSP loaisp)
        {
            tbLoaiSPDAL loaispDAL = new tbLoaiSPDAL();
            loaispDAL.Update(loaisp);
        }
        public static void Delete_LoaiSP(int iD)
        {
            tbLoaiSPDAL loaispDAL = new tbLoaiSPDAL();
            loaispDAL.Delete(iD);
        }
        public static tbLoaiSP.tbLoaiSPCollection Get(string where, int pageindex, int pagesize, string orderby, string orderdirection, out int total)
        {
            tbLoaiSPDAL loaispDAL = new tbLoaiSPDAL();
            return loaispDAL.Get(where, pageindex, pagesize, orderby, orderdirection, out total);
        }
        public static Entities.tbLoaiSP.tbLoaiSPCollection GetAll()
        {
            int total = 0;
            tbLoaiSPDAL loaispDAL = new tbLoaiSPDAL();
            return loaispDAL.Get("where 1=1", 0, 0, Entities.tbLoaiSP.tbLoaiSPColumns.IDLoaiSP.ToString(), "ASC", out total);
        }
        public static tbLoaiSP GetByID(int iD)
        {
            int total = 0;
            tbLoaiSPDAL loaispDAL = new tbLoaiSPDAL();
           tbLoaiSP.tbLoaiSPCollection loaispCollection = loaispDAL.Get("where " + Entities.tbLoaiSP.tbLoaiSPColumns.IDLoaiSP.ToString() + "=" + iD.ToString(), 0, 0, Entities.tbLoaiSP.tbLoaiSPColumns.IDLoaiSP.ToString(), "ASC", out total);
            if (loaispCollection.Count > 0)
                return loaispCollection[0];
            return null;
        }
    }
}
